// 封装消息提示，类似于element UI的message

import { createVNode, render } from "vue"
import YikeMessage from './YikeMessage.vue'

const divVNode = createVNode('div', {class: 'yike-message-container'})
render(divVNode, document.body)

const div= divVNode.el

const YKMessage = ({ message, type }) => {
    // 动态创建虚拟DOM
    const comVNdoe = createVNode(YikeMessage, { message, type })
    // 渲染到body页面中
    render(comVNdoe, div)
    // 提示6s后自动卸载
    setTimeout(() => {
        render(null, div)
    }, 6000)
}

export default YKMessage
